/**
 * 
 */
package map.model;

import java.util.HashMap;
import java.util.Map;

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
 * @author balage
 *
 */
public abstract class MapItem {

	public final long id;
	
	public MapItem(Element node) {
		id = Long.parseLong(node.getAttribute("id"));
		NodeList nl = node.getElementsByTagName("tag");
		for(int i = 0;i<nl.getLength();i++){
			Node n = nl.item(i);
			if (n instanceof Element){
				String k = ((Element) n).getAttribute("k").toLowerCase().trim();
				String v = ((Element) n).getAttribute("v").toLowerCase().trim();
				//System.out.println("tag: "+k+" = "+v);
				tags.put(k, v);
			}
		}
	}
	
	public final Map<String, String> tags = new HashMap<String, String>();
	
}
